-
Notifications
You must be signed in to change notification settings - Fork 619
Move Sentry config to instrumentation-client.ts #7405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move Sentry config to instrumentation-client.ts #7405
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
""" WalkthroughSentry client-side error monitoring configuration has been moved from a dedicated configuration file to the main client instrumentation file. The Sentry initialization, error filtering, session replay, and tracing settings are now colocated with PostHog analytics setup. An export for Sentry router transition instrumentation has been added. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant Sentry
User->>App: Interacts with dashboard
App->>Sentry: Initialize Sentry with filters, replay, and tracing
App->>Sentry: Report error (if occurs and passes filters)
App->>Sentry: Send session replay (sampled)
App->>Sentry: Trace performance (sampled)
App->>App: Export onRouterTransitionStart for navigation tracing
""" 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (8)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7405 +/- ##
=======================================
Coverage 52.06% 52.06%
=======================================
Files 945 945
Lines 63565 63565
Branches 4208 4208
=======================================
Hits 33098 33098
Misses 30361 30361
Partials 106 106
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/dashboard/src/instrumentation-client.ts (1)
29-55: Consider using environment variable for Sentry DSNThe Sentry configuration looks comprehensive with appropriate domain filtering. However, the DSN is hardcoded which could be a security concern.
Consider moving the DSN to an environment variable:
- dsn: "https://[email protected]/6690186", + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN || "https://[email protected]/6690186",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/dashboard/sentry.client.config.ts(0 hunks)apps/dashboard/src/instrumentation-client.ts(2 hunks)
💤 Files with no reviewable changes (1)
- apps/dashboard/sentry.client.config.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Size
- GitHub Check: Lint Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
apps/dashboard/src/instrumentation-client.ts (6)
1-1: LGTM: Sentry import added correctlyThe Sentry import is properly structured and follows the recommended pattern for Next.js applications.
5-8: Good organization with clear section separatorsThe section headers improve code readability and make it clear where PostHog and Sentry configurations are located.
Also applies to: 25-28
56-100: Comprehensive error filtering configurationThe
ignoreErrorsarray is well-structured and covers a wide range of common non-actionable errors from browser extensions, third-party scripts, and benign runtime issues. This should effectively reduce noise in error reporting.
103-119: Appropriate Sentry integration and sampling configurationThe Session Replay integration with media blocking and text masking provides good privacy protection. The sampling rates (10% for sessions/traces, 100% for error replays) strike a reasonable balance between data collection and performance impact.
121-123: Router instrumentation export is correctly implementedThe export of
captureRouterTransitionStartasonRouterTransitionStartfollows the recommended pattern for Next.js router instrumentation.
29-119: The previous ripgrep invocation failed to recognize thetsxtype. Let’s retry using a simpler find/grep approach:#!/bin/bash # 1. Check if the old config file still exists echo "Checking for old sentry.client.config.ts file:" find . -type f -name "sentry.client.config.ts" # 2. Search for any references to the old config filename echo -e "\nSearching for references to 'sentry.client.config' across the repo:" rg -i "sentry\.client\.config"
size-limit report 📦
|
d3b03a2 to
0ce5f79
Compare
Merge activity
|
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Integrated Sentry error monitoring and Session Replay for improved error tracking and diagnostics in the dashboard.
- Enhanced filtering of irrelevant errors and noise from third-party scripts and browser extensions.
- **Chores**
- Updated analytics setup to include Sentry alongside existing PostHog integration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- start pr-codex -->
---
## PR-Codex overview
This PR focuses on integrating `Sentry` for error tracking and monitoring within the `instrumentation-client.ts` file, alongside an existing `PostHog` setup for analytics.
### Detailed summary
- Removed `sentry.client.config.ts`.
- Added `Sentry` initialization with configuration settings including `allowUrls`, `denyUrls`, and `ignoreErrors`.
- Configured `Sentry` for session replay with `integrations`, `replaysOnErrorSampleRate`, and `tracesSampleRate`.
- Exported `onRouterTransitionStart` for router transition tracking.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
0ce5f79 to
b61ce67
Compare
|

Summary by CodeRabbit
New Features
Chores
PR-Codex overview
This PR focuses on integrating
Sentryfor error tracking in theinstrumentation-client.tsfile, while retaining the existingPostHogconfiguration.Detailed summary
sentry.client.config.ts.Sentryinitialization with various configurations such asallowUrls,denyUrls,dsn, andignoreErrors.replaysOnErrorSampleRateandtracesSampleRate.onRouterTransitionStartfor router navigation tracking.